<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
if($_RQ['op']=='get'){
	$return['set']=$this->plugin_setting('setting');
	$return['set']['loginlogo']=tomedia($return['set']['loginlogo']);
	if($_SESSION['os']=='windows'){
		$return['session_id']=session_id();
	}
	$_SESSION['uid']=0;
	$_SESSION['mid']=0;
	$_SESSION['userid']=0;
	//if($_SESSION['uid']){
	//	exi('','error','jy_merch/manage.index/');
	//}
	$_SESSION['logout_forward']='jy_jd/manage.login/';
	$return['info']['forward']='jy_jd/manage.index/'; 
	set_html('title','商户登录');
	exi($return);
}
if($_RQ['op']=='post'){
	$post=get_postdata();
	$user=pdo_get('jy_jd_user',array('uniacid'=>$_SESSION['uniacid'],'uname'=>$post['username']));
	if(!$user || $post['password']!=base64_decode($user['upass'])){
		exi('用户名或密码错误','error');
	}
	if(!$user['mid']){
		exi('此账号未绑定管理员，请绑定管理员','error');
	}
	$_SESSION['uid']=$user['mid'];
	$_SESSION['mid']=$user['mid'];
	$_SESSION['userid']=$user['id'];
	$_SESSION['member']['username']=$user['uname'];
	$url=custom_url('jy_jd/manage.index/',true);
	exi('登陆成功','',$url);
	
}